//
//  DataEnvironment.m
//  
//
//  Copyright 2010 itotem. All rights reserved.
//


#import "DataEnvironment.h"
#import "DataCacheManager.h"
#import "ITTNetworkTrafficManager.h"
@interface DataEnvironment()
- (void)restore;
@end
@implementation DataEnvironment

static DataEnvironment *sharedInst = nil;
@synthesize urlRequestHost = _urlRequestHost;

#pragma mark - singleton lifecycle
+ (id)sharedDataEnvironment{
	@synchronized( self ) {
		if ( sharedInst == nil ) {
            [[self alloc] init];
		}
	}
	
	return sharedInst;
}

- (id)init{
    self = [super init];
	if ( sharedInst != nil ) {
		
	}else if (self) {
		sharedInst = self;
		[self restore];
		
	}
	return sharedInst;
}

-(void)clearNetworkData{
    [[DataCacheManager sharedManager] clearAllCache];
}

- (NSUInteger)retainCount{
	return NSUIntegerMax;
}

- (oneway void)release{
}

- (id)retain{
	return sharedInst;
}

- (id)autorelease{
	return sharedInst;
}

- (void)restore{
    _urlRequestHost = [REQUEST_DOMAIN retain];
}
- (void)dealloc{
    RELEASE_SAFELY(_urlRequestHost);
	[super dealloc];
}


@end